Skip to content

fix(id-mail): validate() reports null/non-object config entries instead of crashing; retire optional in the deploy flow - #6948

Merged
dezren39 merged 1 commit into
mainfrom
creator-b/6947-idmail-deploy-validate
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
creator-b/6947-idmail-deploy-validate

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6947.

deploy.mjs's validate() is the fail-closed gate for the id-mail Worker deploy (#3281 discipline), but it crashed on the malformed shapes it exists to catch, and it blessed a config the deploy flow then crashed on:

  • Validator crashes (all verified pre-fix, probe ~/git/fleet/probe-idmail-deploy, real deploy.mjs + stub bws/wrangler/fetch): top-level null → TypeError at the first check; templates: [null], a null caller, and a null grant → TypeErrors naming no config field; transports: "email"/5 → (c.transports ?? []).every is not a function (and, for a number, c.transports?.includes is not a function at the grant check); templates: 5/{} → not-iterable TypeError. A merely wrong scalar (bad worker name) was already reported correctly through the aggregated config.json is invalid: error.
  • retire mismatch: validate() treats retire as optional (c.retire ?? []) while the deploy sequence iterated config.retire unconditionally — a retire-less config passed --dry-run ("config is valid") and then crashed the real deploy at the retire loop, after the bws read and wrangler dry-run had already run.

Fix (deploy.mjs only):

  • validate() returns ["config must be a JSON object"] for a non-object top level instead of dereferencing it.
  • All transports list operations go through one normalized transportList (empty when not an array); the existing isStringList check reports the shape.
  • The templates loop iterates only a real list and reports a null/non-object entry as templates[<i>] must be an object with subject and body; caller and grant entries get the same named-object guard.
  • The deploy flow iterates config.retire ?? [], matching validation.

Tests (deploy.test.mjs, same stub harness): makeSandbox learned config overrides (raw or mutate) with crash-safe bws key derivation; new cases pin all seven malformed shapes to the aggregated validation error with zero external calls and no TypeError, and pin a retire-less config to a full stubbed deploy. New tests fail pre-fix (2 fail / 4 pass), pass post-fix; full worker suite (deploy + runtime) 11/11 on the laptop. Post-fix probe: every malformed shape now ends in the aggregated error, control + retire-less deploys exit 0.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ad of crashing; retire optional in the deploy flow (#6947)
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 20:10
@dezren39 dezren39 added kind/bug Something isn't working (prefixed form of the classic bug label) source/creator Filed by the new-issue-creator job app/id-mail pkgs/nixos id-mail service and worker labels Nov 7, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T20:11:15.924338Z 3e1ca71 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app/id-mail pkgs/nixos id-mail service and worker kind/bug Something isn't working (prefixed form of the classic bug label) source/creator Filed by the new-issue-creator job

Projects

None yet

1 participant